import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
// import { incremented, decremented } from "../store";

function FunctionTest() {
  const counter = useSelector(state => state.counter.value)
  const dispatch = useDispatch()
  // const increment = () => dispatch(incremented())
  // const decrement = () => dispatch(decremented())
  const increment = () => dispatch({ type: 'counter/incremented' })
  const decrement = () => dispatch({ type: 'counter/decremented' })

  return (
    <div>
      <h1>{counter}</h1>
      <button onClick={increment}>+</button>
      <button onClick={decrement}>-</button>
    </div>
  )
}

export default FunctionTest
